import Vue from "vue";
import Router from "vue-router";

Vue.use(Router);

const originalPush = Router.prototype.push;

Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err);
}; //重写路由的push方法，解决$router.push跳转到一个相同的路由报错问题

let router = new Router({
  routes: [
    // 登录
    {
      path: "/login",
      name: "login",
      component: require("@/page/login").default,
    },
    {
      path: "*",
      redirect: "/",
    },
    {
      path: "/",
      name: "",
      component: require("@/page/indexs").default,
    },
    // 配置向导
    {
      path: "/install",
      name: "install",
      component: require("@/page/install/install").default,
    },
    {
      //网络模式
      path: "install/pageInstall",
      name: "pageInstall",
      component: require("@/page/install/pageInstall").default,
    },
    {
      //单机模式
      path: "install/standAlone",
      name: "standAlone",
      component: require("@/page/install/standAlone").default,
    },
    {
      path: "/loginAuth",
      name: "loginAuth",
      component: require("@/page/loginAuth").default,
    },
    // 测试
    {
      path: "/ceslist",
      name: "ceslist",
      component: require("@/page/home/list").default,
    },
  ],
});

export default router;
